home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak Vol E-12
/
Vol E-12.iso
/
games
/
barbie
/
barbie_l.swf
/
scripts
/
frame_1
/
DoAction.as
Wrap
Text File
|
2012-05-21
|
4KB
|
168 lines
function move()
{
_root.nextr = _root.oldrows + _root.dirr;
_root.nextc = _root.oldcols + _root.dirc;
if(8 < _root.grid[_root.nextr][_root.nextc])
{
_root.grid[_root.oldrows][_root.oldcols] = _root.prevplace;
_root.prevplace = _root.grid[_root.nextr][_root.nextc];
_root.grid[_root.nextr][_root.nextc] = 9;
_root.oldrows = _root.nextr;
_root.oldcols = _root.nextc;
with(_root.man)
{
play();
}
}
else
{
trace("wall");
_root.reset = 0;
}
}
function setup(num)
{
startx = 300;
starty = 150;
_root.countup = 0;
i = 0;
while(i < _root.rows)
{
_root.newstartx = _root.startx - i * 30;
_root.newstarty = _root.starty + i * 15;
k = 0;
while(k < _root.cols)
{
_root.attachMovie("square" + num,"sq" + _root.countup,_root.countup * 2);
setProperty(eval("_root.sq" + _root.countup), _X, _root.newstartx + k * 30);
setProperty(eval("_root.sq" + _root.countup), _Y, _root.newstarty + k * 15);
whatamic = _root.countup % _root.cols;
whatamir = Math.floor(_root.countup / _root.rows);
whatami = _root.grid[whatamir][whatamic];
with(eval("_root.sq" + _root.countup))
{
gotoAndStop(whatami);
}
with(_root.walls)
{
gotoAndStop(num);
}
_root.countup += 1;
k++;
}
i++;
}
_root.fadein = 1;
}
function direction()
{
if(_root.dir == 1)
{
_root.dirc = 0;
_root.dirr = -1;
_root.reset = 0;
with(_root.man)
{
gotoAndStop("up");
}
}
if(_root.dir == 2)
{
_root.dirc = 1;
_root.dirr = 0;
_root.reset = 0;
with(_root.man)
{
gotoAndStop("right");
}
}
if(_root.dir == 3)
{
_root.dirc = 0;
_root.dirr = 1;
_root.reset = 0;
with(_root.man)
{
gotoAndStop("down");
}
}
if(_root.dir == 4)
{
_root.dirc = -1;
_root.dirr = 0;
_root.reset = 0;
with(_root.man)
{
gotoAndStop("left");
}
}
}
function stage1()
{
_root.turtle = 0;
_root.door = 0;
_root.dir = 4;
_root.direction();
_root.bell = 0;
_root.prevplace = 10;
bridge = 0;
with(_root.walls.port)
{
gotoAndStop(1);
}
_root.r0 = "1,1,1,1,1,1,1,1,1,1,1";
_root.r1 = "1,10,10,10,10,15,10,10,10,10,1";
_root.r2 = "1,2,2,2,2,10,14,10,2,2,1";
_root.r3 = "1,11,11,11,11,11,12,11,11,11,1";
_root.r4 = "1,11,11,11,11,11,12,11,11,11,1";
_root.r5 = "1,11,11,11,11,11,12,11,11,11,1";
_root.r6 = "1,2,2,2,2,10,10,10,2,2,1";
_root.r7 = "1,10,10,10,10,10,10,10,10,10,1";
_root.r8 = "1,10,10,10,10,10,10,10,2,10,1";
_root.r9 = "1,10,10,10,10,9,10,10,2,13,1";
_root.r10 = "1,1,1,1,1,1,1,1,1,1,1";
i = 0;
while(i < rows)
{
var temp = eval("_root.r" + i);
_root.grid[i] = temp.split(",");
i++;
}
i = 0;
while(i < rows)
{
k = 0;
while(k < cols)
{
_root.grid[i][k] = Number(_root.grid[i][k]);
k++;
}
i++;
}
setup(1);
_root.man.begin();
}
function killme()
{
trace("killme called");
with(_root.man)
{
gotoAndPlay("gareth");
}
with(_root.man)
{
play();
}
}
grid = new Array();
rows = 11;
cols = 11;
reset = 1;
_root.mystage = 1;
_root.countup = 0;
_root.startup = 0;
_root.fadein = 0;
_root.fadeout = 0;
totalcells = rows * cols;
stop();